


import { LIST, ADD, DEL } from './../action/homeAction.js';
export function homeReducers(state={list:[],id:''}, action) {
    switch (action.type) {
        case ADD:
            let newList = Array.from(state.list)//Array.from创建新数组
                newList.push(action.list[action.id]);   
            return Object.assign({},state,{
                list:newList
            })
        case DEL:
           let newLists = Array.from(state.list);
            newLists.shift(0)
            return Object.assign({},state,{
                list:newLists
            })
        case LIST:
            return newState.list = action.list
        default:
            return state;
    }
}
// dengxiagai  xianchu chrome